Skip to content

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Oct 9, 2025

Adds debug predicates for identifying data flow nodes with high utility. I used these predicates in #20627.

@hvitved hvitved force-pushed the dataflow/debug-predicates branch from ee3f6e0 to f71cfac Compare October 20, 2025 08:00
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Oct 20, 2025
@hvitved hvitved marked this pull request as ready for review October 20, 2025 08:03
@hvitved hvitved requested a review from a team as a code owner October 20, 2025 08:03
@Copilot Copilot AI review requested due to automatic review settings October 20, 2025 08:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds debug predicates to the data flow analysis module to identify nodes with high utility. The changes introduce debugging capabilities that expose statistics and metrics about data flow nodes, including fan-out, fan-in, and path node counts for analysis purposes.

Key changes:

  • Introduces a new Debug module within the stage logic containing various debugging predicates
  • Adds predicates to identify maximum fan-out, fan-in, and path node counts
  • Exposes these debug predicates through public interfaces for each stage

*/
additional module Graph {
private newtype TPathNode =
newtype TPathNode =
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Changing the visibility of TPathNode from private to public may expose internal implementation details. Consider if this change is necessary for the debug functionality or if the debug predicates can work with the existing private type.

Suggested change
newtype TPathNode =
private newtype TPathNode =

Copilot uses AI. Check for mistakes.

Comment on lines +2518 to +2521
private int fanOut(PathNodeImpl n) {
result = strictcount(n.getASuccessorImpl(_)) and
not n.isArbitrarySource()
}
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The fanOut predicate lacks documentation explaining why arbitrary sources are excluded from the count. Consider adding a comment to clarify this design decision.

Copilot uses AI. Check for mistakes.

Comment on lines +2523 to +2526
private int fanIn(PathNodeImpl n) {
result = strictcount(PathNodeImpl pred | n = pred.getASuccessorImpl(_)) and
not n.isArbitrarySink()
}
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The fanIn predicate lacks documentation explaining why arbitrary sinks are excluded from the count. Consider adding a comment to clarify this design decision.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@aschackmull aschackmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hvitved hvitved merged commit 85abcdd into github:main Oct 20, 2025
39 checks passed
@hvitved hvitved deleted the dataflow/debug-predicates branch October 20, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DataFlow Library no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants